<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
  <meta charset="utf-8">
  <title></title>
  <script type="text/javascript" src="js/main.js"></script>
</head>
<body>
  <p id="viewer"></p>

  <script src="https://cdn.jsdelivr.net/npm/bluebird@3/js/browser/bluebird.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/whatwg-fetch@2.0.3/fetch.min.js"></script>
  <script>
    fetch('https://v1.hitokoto.cn/?c=d')
    .then(function (res){
      return res.json();
    })
    .then(function (data) {
      var viewer = document.getElementById('viewer');
      viewer.innerHTML = "{'data' : '" + data.hitokoto + "'}";
    })
    .catch(function (err) {
      console.error(err);
    })
  </script>
</body>
</html>
